package com.felix.headFirst.observer;

import java.util.Observable;
import java.util.Observer;

public class ForecastDisplay implements Observer, DisplatElement {

    private float currentPressure = 29.92f;
    private float lastPressure;
    Observable observable;

    public ForecastDisplay(Observable o) {
        WeatherData weatherData = (WeatherData) o;
        observable.addObserver(this);
    }

    @Override
    public void display() {

    }

    @Override
    public void update(Observable o, Object arg) {
        if(o instanceof  WeatherData){
            WeatherData weatherData = (WeatherData) o;
            lastPressure = currentPressure;
            currentPressure = weatherData.getPressure();
            display();
        }
    }
}
